Images and Sound
Images and sounds are pretty easy to do in BorlandBase and Sprites.
All files need to be in the same directory as all your other files. So when you find a file online, save it to the project directory.
Borland Base
setBackgroundImage ("forest.jpg",2); //this would draw the background at 2x size
- Draw an image on the permanent layer
drawImage("mario.png",40,200,3); //this would draw mario at 40, 200 at 3x size
- Draw an image on the temporary layer
drawImageTemp("mario.png",40,200,3); //this would draw mario at 40, 200 at 3x size
- Play an mp3 (careful, mp3 are better for long music as it takes a bit longer to load)
playMP3("music.mp3"); //this would play an mp3
stopMP3(); //stops the currently playing mp3
playSound ("smash.wav");
Sprite
When you draw the sprite, you can just call drawImage which will draw the sprite at the location (x,y) and its size (current width and height).
public void drawFrog (Graphics g)
{
drawImage(g,"frog.png");
}
- To play a sound (you cant use mp3s)
playSound ("bounce.wav");
|